﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    nutrientDAO dao;
    Nutrient nutrient = new Nutrient();
    protected void Page_Load(object sender, EventArgs e)
    {
       dao = new nutrientDAO();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        insert();
    }

    public void insert()
    {
        nutrient.Id = System.Guid.NewGuid().ToString();
        nutrient.Unit = txtUnit.Text;
        nutrient.Name = txtName.Text;
        nutrient.Type = dropType.SelectedValue.ToString();
        nutrient.Code = int.Parse(txtCode.Text);
        dao.addNew(nutrient);
        Response.Redirect("nutrient.aspx");
    }
}